//
//  AppMacro.h
//  Pet
//
//  Created by karl on 2018/3/2.
//  Copyright © 2018年 karl. All rights reserved.
//

#ifndef AppMacro_h
#define AppMacro_h

#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;
#define BS(blockSelf)  __block __typeof(&*self)blockSelf = self;

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define  DEFAULT_AVATAR_IMAGE [UIImage imageNamed:@"testImg1"]

#define IOS11 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0 ? YES : NO)
#define IOS10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0 ? YES : NO)
#define IOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 ? YES : NO)
#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ? YES : NO)
#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ? YES : NO)

#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#define ApplicationDelegate ((AppDelegate *)[UIApplication sharedApplication].delegate)

#define IS_IPHONEX (SCREEN_WIDTH == 375.f && SCREEN_HEIGHT == 812.f ? YES : NO)

#define PATH_OF_DOCUMENT    [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]

#define IPHONEX_HEADER_HEIGHT (IS_IPHONEX ? 88 : 64)

#define IPHONEX_STATUS_HEIGHT (IS_IPHONEX ? 44 : 20)

#define IPHONEX_FOOTER_HEIGHT (IS_IPHONEX ? 34 : 0)

#define Adapt(x) x * SCREEN_WIDTH / 375

#endif /* AppMacro_h */
